using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

namespace PickGold.Data
{
    public class CDataColumn : DataColumn
    {
        //
        public const string IF_NULL = "$IfNull$";
        public const string LEFT_TRIM = "$LTrim$";
        public const string RIGHT_TRIM = "$RTrim$";
        public const string FULL_TRIM = "$Trim$";
        public const string DATA_LENGTH = "$Length$";
        //
        protected string _Alias = null;
        protected object _Value = null;
        protected EOperator _Operator = EOperator.None;
        //
        public CDataColumn() : base() { }
        public CDataColumn(string columnName) : base(columnName) { }
        public CDataColumn(string columnName, Type dataType) : base(columnName, dataType) { }
        public CDataColumn(string columnName, Type dataType, string expr) : base(columnName, dataType, expr) { }
        public CDataColumn(string columnName, Type dataType, string expr, MappingType type) : base(columnName, dataType, expr, type) { }
        public CDataColumn(DataColumn column) : base(column.ColumnName, column.DataType, column.Expression, column.ColumnMapping)
        {
            this.MaxLength = column.MaxLength;
        }
        //
        public CDataColumn setOperator(EOperator value)
        {
            this.Operator = value;
            return this;
        }
        public EOperator Operator
        {
            set
            {
                this._Operator = value;
            }
            get
            {
                return this._Operator;
            }
        }
        //
        public CDataColumn setValue(object value)
        {
            this.Value = value;
            return this;
        }
        public object Value
        {
            set
            {
                this._Value = value;
            }
            get
            {
                return this._Value;
            }
        }
        //
        public CDataColumn setAlias(string value)
        {
            this.Alias = value;
            return this;
        }
        public string Alias
        {
            set
            {
                this._Alias = value;
            }
            get
            {
                return this._Alias;
            }
        }
        //
        public string NamedAlias
        {
            get
            {
                if (string.IsNullOrEmpty(this._Alias))
                    return this.ColumnName;
                return this._Alias;
            }
        }
        //
        public CDataColumn setPrefix(string value)
        {
            this.Prefix = value;
            return this;
        }
        //
        public CDataColumn setType(Type value)
        {
            this.DataType = value;
            return this;
        }
        //
        public CDataColumn setMaxLength(int value)
        {
            this.MaxLength = value;
            return this;
        }
        //
    }
    //
}
//
